package com.cloudptt.api.models;

import com.cloudptt.api.product.log.Log;

public class SipMsgParser {
    public static String THIS_FILE = "SipMsgParser";
    private String exStr = "";

    private String fromStr = "";
    public SipMsgParser(String msg)
    {
        String[] strArr = msg.split("" + '\n');
        for (int i = 0; i < strArr.length; i++)
        {
            String str = strArr[i].trim().toLowerCase();
            Log.d(THIS_FILE, "SipMsgParser str = " + str);
            if(str.startsWith("callinfo"))
            {
                String[] arr = str.split("" + ':');
                if(arr.length == 2)
                {
                    exStr = arr[1];
                    Log.d(THIS_FILE, "SipMsgParser exStr = " + exStr);
                }
            }
            else if(str.startsWith("from"))
            {
                fromStr= str;
//                String[] arr = str.split("" + ':');
//                Log.d(THIS_FILE, "SipMsgParser arr = " + arr);
//                if(arr.length == 2)
//                {
//                    fromStr = arr[1];
//                }
            }
        }
    }
    public String getExStr() {
        return exStr;
    }
    public String getFromStr() {
        return fromStr;
    }
}
